In recent years, a conventional microcomputer uses a crystal oscillator for generating a clock signal. More practically, an oscillation circuit utilizing the crystal oscillator is used to generate a stable and accurate clock signal. However, the demand for decreasing a production cost of the microcomputer sometimes makes it necessary to substitute the crystal oscillator with a CR oscillator. In this case, an oscillation frequency of the CR oscillator is susceptible to temperature change of the environment, thereby causing an unstableness of the oscillation frequency. Therefore, processes in the microcomputer dependent on the output of the oscillation frequency of the CR oscillator is under an influence of frequency drift due to the temperature dependency of the oscillation frequency. In other words, the processes of the microcomputer may need to be corrected for having isochronal characteristics of execution time when the processes are critically dependent on the oscillation frequency of the CR oscillator.
For example, Japanese patent document JP-A-H05-75445 discloses a technique for maintaining a stable oscillation frequency. That is, the CR oscillator stores a standard oscillation frequency in an EEPROM based on a measurement on a standard measurement condition of an environment that includes a predetermined power source voltage and a predetermined temperature, and utilizes the stored relationship between the frequency and the condition for compensating a current oscillation frequency based on a current measurement of the power source voltage and temperature.
This compensation scheme described above works in the following manner. That is, the oscillation frequency of the CR oscillator is compensated by adjusting a register value for decrement operation in a loop program for time generation to have an appropriate number of loops for, for example, a wait time of 1 ms.
However, the technique described above has a problem when the loop time of a time generation program and/or a base loop time of application programs are under influence of the environmental change. That is, the technique is not applicable to the condition that is susceptible to the environmental change when the loop time is not supposed to change. Further, the throughput of processing of the software, e.g., an execution interval between instructions, an execution time or the like, suffers from the change of the loop time, thereby restricting application of the loop program only to the time generation. Furthermore, a hardware sequencer that implements the above-described process is susceptible to the same problem of fluctuating sequence process time.